import processing.core.PFont;
import processingHandling.WebCamPAppletWrapper;


public class WebCamPAppletWrapperDemo extends WebCamPAppletWrapper{
	
	int redVal, greenVal, blueVal, totalVal, colorVal;	
	PFont font; // Font to write on the screen with
	
	@Override
	public void Setup() {
		// Load and set the font
		font = loadFont("CourierNew36.vlw");
		textFont(font, 32);
	}

	@Override
	public void Draw() {
		colorVal = get(mouseX, mouseY);
		
		// Store each color individual
		redVal = (int) red(colorVal);
		greenVal = (int) green(colorVal);
		blueVal = (int) blue(colorVal);
		totalVal = (redVal + greenVal + blueVal) / 3;
		
		fill(0, 0);
		// Draw a circle by the cursor
		ellipse(mouseX, mouseY, 10, 10);
		
		
		fill (255, 255);
		
		// Draw each color to the applet
		text("R = " + redVal, 5, 30);
		text("G = " + greenVal, 5, 60);
		text("B = " + blueVal, 5, 90);
		text("T = " + totalVal, 5, 120);
		
	}

	@Override
	public int getFrameRate() {
		return 30;
	}

	@Override
	public int getHeight() {
		return 480;
	}

	@Override
	public int getWidth() {
		return 640;
	}

}
